home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / midas.inc < prev    next >
Encoding:
Text File  |  1997-01-16  |  13.3 KB  |  369 lines

  1. ;*      MIDAS.INC
  2. ;*
  3. ;* Simplified MIDAS Sound System API
  4. ;*
  5. ;* $Id: midas.inc,v 1.3 1997/01/16 18:41:59 pekangas Exp $
  6. ;*
  7. ;* Copyright 1996,1997 Housemarque Inc.
  8. ;*
  9. ;* This file is part of the MIDAS Sound System, and may only be
  10. ;* used, modified and distributed under the terms of the MIDAS
  11. ;* Sound System license, LICENSE.TXT. By continuing to use,
  12. ;* modify or distribute this file you indicate that you have
  13. ;* read the license and understand and accept it fully.
  14. ;*
  15.  
  16. ; Note that the Simplified MIDAS API for assembler is implemented in C.
  17. ; The source is in file MIDAS.C.
  18.  
  19. taa ei toimi!
  20.  
  21.  
  22. ;/***************************************************************************\
  23. ;*     MIDAS version defines
  24. ;\***************************************************************************/
  25.  
  26. MVERSION        EQU     0.40a
  27. MVERSTR         EQU     "0.40a"
  28. MVERNUM = 0040h
  29.  
  30.  
  31.  
  32.  
  33. ;/***************************************************************************\
  34. ;*     MIDAS header files:
  35. ;\***************************************************************************/
  36.  
  37. ; Far NULL pointer:
  38. NULL            EQU     0 0
  39.  
  40. INCLUDE "lang.inc"
  41. INCLUDE "errors.inc"
  42. INCLUDE "mglobals.inc"
  43. INCLUDE "mmem.inc"
  44. INCLUDE "rawfile.inc"
  45. INCLUDE "file.inc"
  46. INCLUDE "sdevice.inc"
  47. INCLUDE "mplayer.inc"
  48. INCLUDE "s3m.inc"
  49. INCLUDE "mod.inc"
  50. INCLUDE "mtm.inc"
  51. INCLUDE "timer.inc"
  52. INCLUDE "ems.inc"
  53. INCLUDE "dma.inc"
  54. INCLUDE "dsm.inc"
  55. INCLUDE "vu.inc"
  56. INCLUDE "mconfig.inc"
  57. INCLUDE "mparser.inc"
  58. INCLUDE "vgatext.inc"
  59. INCLUDE "mutils.inc"
  60. INCLUDE "mm.inc"
  61.  
  62.  
  63.  
  64. ;/***************************************************************************\
  65. ;*      MIDAS global variables:
  66. ;\***************************************************************************/
  67.  
  68. GLOBAL LANG GUS : SoundDevice           ; Gravis UltraSound Sound Device
  69. GLOBAL LANG GDC : SoundDevice           ; Gravis UltraSound Sound Device
  70. GLOBAL LANG PAS : SoundDevice           ; Pro Audio Spectrum Sound Device
  71. GLOBAL LANG WSS : SoundDevice           ; Windows Sound System Sound Device
  72. GLOBAL LANG SB : SoundDevice            ; Sound Blaster Sound Device
  73. GLOBAL LANG NSND : SoundDevice          ; No Sound Sound Device
  74.  
  75. NUMSDEVICES = 6                         ; total number of Sound Devices
  76. NUMMPLAYERS = 3                         ; total number of Module Players
  77.  
  78. GLOBAL LANG mpS3M : ModulePlayer        ; Scream Tracker 3 Module Player
  79. GLOBAL LANG mpMOD : ModulePlayer        ; Protracker Module Player
  80. GLOBAL LANG mpMTM : ModulePlayer        ; Multitracker Module Player
  81.  
  82. GLOBAL LANG midasSD : dword             ; current Sound Device
  83. GLOBAL LANG midasMP : dword             ; current Module Player
  84.  
  85.     ; array to pointers to all Sound Devices, in numbering and detection
  86.     ; order - GUS is SD #1:
  87. GLOBAL LANG midasSoundDevices : dword
  88.  
  89. GLOBAL LANG midasDisableEMS : word      ; 1 if EMS usage is disabled
  90.                                         ; (default 0)
  91. GLOBAL LANG midasSDNumber : word        ; Sound Device number (-1 for
  92.                                         ; autodetect, default -1)
  93. GLOBAL LANG midasSDPort : word          ; Sound Device I/O port number
  94.                                         ; (-1 for autodetect or SD default,
  95.                                         ; default -1)
  96. GLOBAL LANG midasSDIRQ : word           ; Sound Device IRQ number (-1 for
  97.                                         ; autodetect or SD default,
  98.                                         ; default -1)
  99. GLOBAL LANG midasSDDMA : word           ; Sound Device DMA channel number
  100.                                         ; (-1 for autodetect or SD default,
  101.                                         ; default -1)
  102. GLOBAL LANG midasSDCard : word          ; Sound Device sound card type
  103.                                         ; (-1 for autodetect or SD default,
  104.                                         ; default -1)
  105. GLOBAL LANG midasMixRate : word         ; Sound Device mixing rate
  106. GLOBAL LANG midasOutputMode : word      ; Sound Device output mode force
  107.                                         ; bits, default 0 (SD default)
  108. GLOBAL LANG midasAmplification : word   ; Forced amplification level or -1
  109.                                         ; for SD default (default -1)
  110. GLOBAL LANG midasChannels : word        ; number of channels open or 0 if no
  111.                                         ; channels have been opened using
  112.                                         ; midasOpenChannels()
  113. GLOBAL LANG midasPlayerNum : word       ; timer music player number
  114.  
  115.  
  116. GLOBAL LANG midasEMSInit : word         ; is EMS heap manager initialized?
  117. GLOBAL LANG midasTMRInit : word         ; is TempoTimer initialized?
  118. GLOBAL LANG midasTMRPlay : word         ; is sound beind player with timer?
  119. GLOBAL LANG midasSDInit : word          ; is Sound Device initialized?
  120. GLOBAL LANG midasSDChans : word         ; are Sound Device channels open?
  121. GLOBAL LANG midasMPInit : word          ; is Module Player initialized?
  122. GLOBAL LANG midasMPPlay : word          ; is Module Player playing?
  123. GLOBAL LANG midasTMRMusic : word        ; is music being player with timer?
  124.  
  125.  
  126.  
  127.  
  128. ;/***************************************************************************\
  129. ;*     MIDAS global functions from MIDAS.C:
  130. ;\***************************************************************************/
  131.  
  132.  
  133.  
  134. ;/***************************************************************************\
  135. ;*
  136. ;* Function:    void midasError(int errNum)
  137. ;*
  138. ;* Description: Prints a MIDAS error message to stderr and exits to DOS
  139. ;*
  140. ;* Input:       int errNum              MIDAS error code
  141. ;*
  142. ;\***************************************************************************/
  143.  
  144. GLOBAL  LANG midasError : far
  145.  
  146.  
  147.  
  148.  
  149. ;/***************************************************************************\
  150. ;*;* Function:    void midasUninitError(int errNum)
  151. ;*
  152. ;* Description: Prints an error message to stderr and exits to DOS without
  153. ;*              uninitializing MIDAS. This function should only be used
  154. ;*              from midasClose();
  155. ;*
  156. ;* Input:       int errNum              MIDAS error code
  157. ;*
  158. ;\***************************************************************************/
  159.  
  160. GLOBAL  LANG midasUninitError : far
  161.  
  162.  
  163.  
  164.  
  165. ;/***************************************************************************\
  166. ;*
  167. ;* Function:    void midasDetectSD(void)
  168. ;*
  169. ;* Description: Attempts to detect a Sound Device. Sets the global variable
  170. ;*              midasSD to point to the detected Sound Device or NULL if no
  171. ;*              Sound Device was detected
  172. ;*
  173. ;\***************************************************************************/
  174.  
  175. GLOBAL  LANG midasDetectSD : far
  176.  
  177.  
  178.  
  179.  
  180. ;/***************************************************************************\
  181. ;*
  182. ;* Function:    void midasInit(void)
  183. ;*
  184. ;* Description: Initializes MIDAS Sound System
  185. ;*
  186. ;\***************************************************************************/
  187.  
  188. GLOBAL  LANG midasInit : far
  189.  
  190.  
  191.  
  192.  
  193. ;/***************************************************************************\
  194. ;*
  195. ;* Function:    void midasClose(void)
  196. ;*
  197. ;* Description: Uninitializes MIDAS Sound System
  198. ;*
  199. ;\***************************************************************************/
  200.  
  201. GLOBAL  LANG midasClose : far
  202.  
  203.  
  204.  
  205.  
  206. ;/***************************************************************************\
  207. ;*
  208. ;* Function:    void midasSetDefaults(void)
  209. ;*
  210. ;* Description: Initializes MIDAS Sound System variables to their default
  211. ;*              states. MUST be the first MIDAS function to be called.
  212. ;*
  213. ;\***************************************************************************/
  214.  
  215. GLOBAL  LANG midasSetDefaults : far
  216.  
  217.  
  218.  
  219.  
  220. ;/***************************************************************************\
  221. ;*
  222. ;* Function:    mpModule *midasLoadModule(char *fileName, ModulePlayer *MP,
  223. ;*                  int (*SaveSampleInfo)(ushort sdInstHandle, uchar *sample,
  224. ;*                  ushort slength, ushort loopStart, ushort loopEnd );
  225. ;*
  226. ;* Description: Loads a module file into memory.
  227. ;*
  228. ;* Input:       char *fileName          Pointer to module file name
  229. ;*              ModulePlayer *MP        Pointer to the Module Player which
  230. ;*                                      will be used for loading the module
  231. ;*              int (*SaveSampleInfo)() Pointer to sample information saving
  232. ;*                                      function. sdInstHandle = Sound Device
  233. ;*                                      instrument handle, sample = pointer to
  234. ;*                                      sample data, slength = sample length,
  235. ;*                                      loopStart = sample loop start,
  236. ;*                                      loopEnd = sample loop end. The
  237. ;*                                      function must return a MIDAS error
  238. ;*                                      code. NULL if no such function is
  239. ;*                                      used.
  240. ;*
  241. ;* Returns:     Pointer to the loaded module structure
  242. ;*
  243. ;* Notes:       The only practical use at this point for SaveSampleInfo() are
  244. ;*              the real VU-meters. To load a module and add the prepare the
  245. ;*              VU meter information use:
  246. ;*                  module = midasLoadModule(fileName, MP, &vuPrepare);
  247. ;*              Note that the definition of SaveSampleInfo matches exactly
  248. ;*              the prototype of vuPrepare().
  249. ;*
  250. ;\***************************************************************************/
  251.  
  252. GLOBAL  LANG midasLoadModule : far
  253.  
  254.  
  255.  
  256.  
  257. ;/***************************************************************************\
  258. ;*
  259. ;* Function:    void midasFreeModule(mpModule *module);
  260. ;*
  261. ;* Description: Deallocates a module from memory
  262. ;*
  263. ;* Input:       mpModule *module        Pointer to module to be deallocated
  264. ;*
  265. ;\***************************************************************************/
  266.  
  267. GLOBAL  LANG midasFreeModule : far
  268.  
  269.  
  270.  
  271.  
  272. ;/***************************************************************************\
  273. ;*
  274. ;* Function:    void midasOpenChannels(int numChans);
  275. ;*
  276. ;* Description: Opens Sound Device channels for sound and music output.
  277. ;*
  278. ;* Input:       int numChans            Number of channels to open
  279. ;*
  280. ;* Notes:       Channels opened with this function can be used for sound
  281. ;*              playing, and modules played with midasPlayModule() will be
  282. ;*              played through the last of these channels. This function is
  283. ;*              provided so that the same number of channels can be open
  284. ;*              the whole time throughout the execution of the program,
  285. ;*              keeping the volume level constant. Note that you must ensure
  286. ;*              that you open enough channels for all modules, otherwise
  287. ;*              midasPlayModule() will fail.
  288. ;*
  289. ;\****************************************************************************/
  290.  
  291. GLOBAL  LANG midasOpenChannels : far
  292.  
  293.  
  294.  
  295.  
  296. ;/***************************************************************************\
  297. ;*
  298. ;* Function:    void midasCloseChannels(void);
  299. ;*
  300. ;* Description: Closes Sound Device channels opened with midasOpenChannels().
  301. ;*              Do NOT call this function unless you have opened the sound
  302. ;*              channels used yourself with midasOpenChannels().
  303. ;*
  304. ;\***************************************************************************/
  305.  
  306. GLOBAL  LANG midasCloseChannels : far
  307.  
  308.  
  309.  
  310.  
  311. ;/***************************************************************************\
  312. ;*
  313. ;* Function:    midasPlayModule(mpModule *module, int numEffectChns)
  314. ;*
  315. ;* Description: Loads a module into memory, points midasMP to the correct
  316. ;*              Module Player and starts playing it.
  317. ;*
  318. ;* Input:       mpModule *module        Module loaded with midasLoadModule()
  319. ;*              int numEffectChns       Number of channels to open for sound
  320. ;*                                      effects. Ignored if sound channels
  321. ;*                                      have already been opened with
  322. ;*                                      midasOpenChannels().
  323. ;*
  324. ;* Returns:     Pointer to module structure. This function can not fail,
  325. ;*              as it will call midasError() to handle all error cases.
  326. ;*
  327. ;* Notes:       The Sound Device channels available for sound effects are the
  328. ;*              _first_ numEffectChns channels. So, for example, if you use
  329. ;*              midasPlayModule(module, 3), you can use channels 0-2 for sound
  330. ;*              effects. If you already have opened channels with
  331. ;*              midasOpenChannels(), the module will be played with the last
  332. ;*              possible channels, so that the first channels will be
  333. ;*              available for sound effects. Note that if not enough channels
  334. ;*              are open this function will fail.
  335. ;*
  336. ;\****************************************************************************/
  337.  
  338. GLOBAL  LANG midasPlayModule : far
  339.  
  340.  
  341.  
  342.  
  343. ;/***************************************************************************\
  344. ;*
  345. ;* Function:    void midasStopModule(mpModule *module)
  346. ;*
  347. ;* Input:       mpModule *module        the module which is being played
  348. ;*
  349. ;* Description: Stops playing a module and uninitializes the Module Player.
  350. ;*              If sound channels were NOT opened through midasOpenChannels(),
  351. ;*              but by letting midasPlayModule() open them, they will be
  352. ;*              closed. Sound channels opened with midasOpenChannels() are NOT
  353. ;*              closed and must be closed separately.
  354. ;*
  355. ;\***************************************************************************/
  356.  
  357. GLOBAL  LANG midasStopModule : far
  358.  
  359.  
  360. ;* $Log: midas.inc,v $
  361. ;* Revision 1.3  1997/01/16 18:41:59  pekangas
  362. ;* Changed copyright messages to Housemarque
  363. ;*
  364. ;* Revision 1.2  1996/05/30 22:38:46  pekangas
  365. ;* no changes?
  366. ;*
  367. ;* Revision 1.1  1996/05/22 20:49:33  pekangas
  368. ;* Initial revision
  369. ;*